package com.youway.ddd.demo2.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import lombok.Data;

//书架空间 (贫血模型), 该实体为聚合根
@Data
@Entity
@Table(name = "bookshelf_space")
public class BookshelfSpace {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Long id;

	@ManyToOne
	@JoinColumn(name = "bookshelfId", referencedColumnName = "id")
	private Bookshelf bookshelf;
	
	@OneToOne
    @JoinColumn(name="bookId", referencedColumnName="id")
	private Book book;
}
